﻿using CTP.CRM.Core.SqlSugar.Options;
using SqlSugar;

namespace CTP.CRM.Core.SqlSugar
{
    //
    // 摘要:
    //     SqlSugar启动扩展
    public static class SqlsugarStartupExtensions
    {
        //
        // 摘要:
        //     添加SqlSugar配置
        //
        // 参数:
        //   services:
        //
        //   optionAction:
        //
        //   onExecuting:
        //
        //   assemblyName:
       // [Obsolete("使用CTP.ORM.SqlSugar包的AddSqlSugar 方法替换")]
        public static IServiceCollection AddSqlsugar(this IServiceCollection services, Action<List<SqlsugarOptions>> optionAction, Action<object, DataFilterModel> onExecuting, params string[] assemblyName)
        {
            List<SqlsugarOptions> list = new List<SqlsugarOptions>();
            optionAction(list);
            SqlsugarScopeBasic.Init(list, onExecuting, services, assemblyName);
            return services;
        }
    }
}
